package com.microcore.service.asserts.impl;

import com.microcore.service.asserts.condition.CompareCondition;
import com.microcore.service.asserts.model.AssertModel;
import org.apache.commons.lang.StringUtils;

/**
 * @author LeiZhenYang
 * @date 2019.01.07
 */
public class isNotNullAssert implements IAssert {

    @Override
    public boolean run(Object value, AssertModel model) {
        if (value != null && model.getType().equals(CompareCondition.Type.Str)) {
            return StringUtils.isNotBlank(value.toString());
        }
        return value != null;
    }
}
